<template>
  <div>
    <van-field label='姓名' v-model='form.name'/>
    <van-field label='金额' v-model='form.money'/>
    <van-field label='机构名称' v-model='form.company'/>

    <h5>客户经理</h5>
      <select v-model="form.kh_id">
        <option v-for=" i in kehujl" :key="i.id" :value="i.id">{{i.company_name}}</option>
      </select>

    <h5>公司</h5>
    <select v-model="form.ly_id">
      <option v-for=" i in ly" :key="i.id" :value="i.id">{{i.name}}</option>
    </select>
    <van-button @click='submit'>提交</van-button>

  </div>
</template>

<script>
import maxios from '../../http/axios'
export default {
  name: "add_y",
  data(){
    return{
      form:{},
      kehujl:[],
      ly:[],
    }
  },
  methods:{
    submit(){
      maxios('http://127.0.0.1:8000/users/post_jilu/','post',this.form).then(res=>{
        if(res.data.code==200){
          alert('ok')
        }else {
          alert('no')
        }
      })
    },
    get_kehujl(){
      maxios('http://127.0.0.1:8000/users/getkehu/','get').then(res=>{
        this.kehujl = res.data.list
      })
    },
    get_ly(){
      maxios('http://127.0.0.1:8000/users/ly/','get').then(res=>{
        this.ly = res.data.list
      })
    }

  },
  mounted() {
    this.get_kehujl()
    this.get_ly()
  }
}
</script>

<style scoped>

</style>